package Manger.FunctionPkg;

import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Scene;
import javafx.scene.web.WebView;

import javax.swing.*;
public class SearchLib implements Win{
    JFrame frame;
    private final JPanel panel1 = new JPanel();
    String url = "https://zhongyibaike.com/";
    @Override
    public void init() {
        frame = new JFrame();
        frame.setTitle("百科搜索");
        frame.setLayout(null);
        frame.setVisible(true);
        frame.setContentPane(panel1);
        frame.setBounds(558,138,800,630);
    }
    SearchLib(){
        JFXPanel jfxPanel = new JFXPanel();
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                WebView webView= new WebView();
                jfxPanel.setScene(new Scene(webView));
                webView.getEngine().load(url);
            }
        });
        panel1.add(jfxPanel);
        panel1.setBounds(0,0,735,750);
        init();
    }
}
